// table操作列根据操作权限控制是否展示操作列
export function isExistColumn(column) {
  if (column.hidden) {
    return false
  }
  if (column.type === 'authLink') {
    let linkIds = []
    column.actionArr.forEach(ele => {
      if (!!ele.link_id) {
        linkIds.push(ele.link_id)
      }
    });
    return linkIds.some(ele =>
      this.$store.state.permission.btnAuth.indexOf(
        this.$route.path + '{' + ele + '}'
      ) > -1
    )
  }
  if (column.id){
    return this.$store.state.permission.btnAuth.indexOf(this.$route.path+"{"+column.id+"}") > -1;
  }
  if (column.actionArr && column.actionArr.length > 0){
    let permission = false
    for (let i = 0; i < column.actionArr.length; i++) {
      if(!column.actionArr[i].id){
        return true
      }
      if(column.actionArr[i].id && this.$store.state.permission.btnAuth.indexOf(this.$route.path+"{"+column.actionArr[i].id+"}") > -1){
        permission = this.$store.state.permission.btnAuth.indexOf(this.$route.path+"{"+column.actionArr[i].id+"}")
        break;
      }
    }
    return permission
  }
  return true
}
